package com.oliver.oliveraiagent.constant;

public class UserContext {
    // 使用InheritableThreadLocal支持子线程访问（需注意线程池场景）
    private static final ThreadLocal<Integer> currentUserId = new InheritableThreadLocal<>();

    public static void setCurrentUserId(Integer userId) {
        currentUserId.set(userId);
    }

    public static Integer getCurrentUserId() {
        return currentUserId.get();
    }

    public static void clear() {
        currentUserId.remove();
    }
}